import request from '@/config/axios'
import type { Continent } from './types'

export const getContinentsListApi = (params: any): Promise<IResponse> => {
  return request.get({ url: '/continents', params })
}

export const createContinentsApi = (data: Partial<Continent>): Promise<IResponse> => {
  return request.post({ url: '/continents', data })
}

export const updateContinentsApi = (id: string, data: Partial<Continent>): Promise<IResponse> => {
  return request.put({ url: `/continents/id/${id}`, data })
}

export const getContinentsDetailApi = (id: string): Promise<IResponse<Continent>> => {
  return request.get({ url: `/continents/id/${id}` })
}

export const delContinentsListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/continents/id/${ids[0]}` })
}
